package com.example.inteldoc.common.swagger;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * inteldoc SwaggerAutoConfiguration class
 *
 * @author xisheng
 * @date 2023/08/18
 */
@EnableSwagger2WebMvc
@Configuration
public class SwaggerAutoConfiguration {

    @Bean
    public Docket devDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("施工养护爬虫服务接口")
                .ignoredParameterTypes(MyRequestBody.class)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.inteldoc.controller"))
                .paths(PathSelectors.any()).build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("施工养护爬虫服务")
                .description("施工养护爬虫服务")
                .version("2.0").build();
    }
}
